SetServiceStatus (Structures)
Last changed: Shavais-70.102.219.194

.
Summary
TODO - a short description

C# Definition:

    public enum SimpleServiceCustomCommands { StopWorker = 128, RestartWorker, CheckWorker };

    [StructLayout(LayoutKind.Sequential)]
    public struct SERVICE_STATUS
    {
    public int serviceType;
    public int currentState;
    public int controlsAccepted;
    public int win32ExitCode;
    public int serviceSpecificExitCode;
    public int checkPoint;
    public int waitHint;
    }

    public enum State
    {
    SERVICE_STOPPED = 0x00000001,
    SERVICE_START_PENDING = 0x00000002,
    SERVICE_STOP_PENDING = 0x00000003,
    SERVICE_RUNNING = 0x00000004,
    SERVICE_CONTINUE_PENDING = 0x00000005,
    SERVICE_PAUSE_PENDING = 0x00000006,
    SERVICE_PAUSED = 0x00000007,
    }

[DllImport("ADVAPI32.DLL", EntryPoint = "SetServiceStatus")]

public static extern bool SetServiceStatus(IntPtr hServiceStatus, SERVICE_STATUS lpServiceStatus);

    protected override void OnStart(string[] args)
    {

        IntPtr handle = this.ServiceHandle;
        myServiceStatus.currentState = (int)State.SERVICE_START_PENDING;
        SetServiceStatus(handle, myServiceStatus);

        //etc...

VB Definition:

Declare Function SetServiceStatus Lib "advapi32.dll" (

    ByVal hServiceStatus As Integer,
    ByRef lpServiceStatus As SERVICE_STATUS)
    As Integer

User-Defined Field Types:

None.

Notes:

None.

Documentation